<template>
  <div v-loading="fullscreenLoading"
    element-loading-text="拼命加载中"
    element-loading-spinner="el-icon-loading"
    element-loading-background="rgba(255, 255, 255, 1)" style="height: -webkit-fill-available;">
    <template v-if="!fullscreenLoading">
      <viewBox body-padding-bottom="55px" style="width:100%;position:fixed;left:0;top:0;z-index:100;max-width: 640px;overflow-x: hidden;">
        <Header />
        <BlockItem v-for="(obj, index) in menuList" :data="obj" :key="index"/>
      </viewBox>
    </template>
  </div>
</template>



<script>
import {list} from '@/api/sys/menu'
import { Loading, TransferDom, ViewBox } from 'vux'
import Header from '@/components/home/header/header'
import BlockItem from '@/views/module-home/block-item/'
import { mapState } from 'vuex'
export default {
  name: 'index',
  directives: {
    TransferDom
  },
  components: { Header, BlockItem, Loading, ViewBox
  },
  computed: {
    ...mapState({
      isLoading: state => state.vux.isLoading
    })
  },
  data () {
    return {
      menuList: null,
      fullscreenLoading: true
    }
  },
  created () {
    this.getMenuList()
  },
  methods: {
    getMenuList () {
      list().then(res => {
        this.menuList = res.data.data
        // setTimeout(() => {
        this.fullscreenLoading = false
        // }, parseInt(Math.random() * 1000))
      })
    }
  }
}
</script>
<style>


</style>

